package com.example.plan.controller;

import com.example.plan.common.result.Result;
import com.example.plan.model.dto.order.OrderDTO;
import com.example.plan.model.entity.Order;
import com.example.plan.service.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;


@Data
@Slf4j
@Api(tags = "订单模块")
@RestController
@RequestMapping("orders")
public class OrderController {

    private final OrderService orderService;


    @ApiOperation(value = "创建订单")
    @PostMapping("/createOrder")
    public Result<Order> createOrder(@RequestBody Order order) {
        return orderService.createOrder(order);
    }

    @ApiOperation(value = "查询订单")
    @GetMapping("/getOrder/{orderId}")
    public Result<Order> getOrder(@PathVariable Long orderId) {
        return orderService.getOrder(orderId);
    }


    @ApiOperation(value = "更新订单")
    @PutMapping("/updateOrder")
    public Result<Void> updateOrder(@RequestBody OrderDTO orderDTO) {
        return orderService.updateOrder(orderDTO);
    }

    @ApiOperation(value = "删除订单")
    @DeleteMapping("/deleteOrder/{orderId}")
    public Result<Void> deleteOrder(@PathVariable Long orderId) {
        orderService.deleteOrder(orderId);
        return Result.success("订单删除成功");
    }
//
//    @ApiOperation(value = "批量删除订单")
//    @DeleteMapping("/deleteOrderBatch")
//    public Result<?> deleteOrderBatch(@RequestBody Long[] orderIds) {
//        return orderService.deleteOrderBatch(orderIds);
//    }
//
//    @ApiOperation(value = "批量更新订单")
//    @PutMapping("/updateOrderBatch")
//    public Result<?> updateOrderBatch(@RequestBody Order[] orders) {
//        return orderService.updateOrderBatch(orders);
//    }
//
//    @ApiOperation(value = "批量创建订单")
//    @PostMapping("/createOrderBatch")
//    public Result<?> createOrderBatch(@RequestBody Order[] orders) {
//        return orderService.createOrderBatch(orders);
//    }
//
//    @ApiOperation(value = "批量查询订单")
//    @GetMapping("/getOrderBatch")
//    public Result<?> getOrderBatch(@RequestBody Long[] orderIds) {
//        return orderService.getOrderBatch(orderIds);
//    }
//
//    @ApiOperation(value = "批量查询订单列表")
//    @GetMapping("/getOrderListBatch")
//    public Result<?> getOrderListBatch(@RequestBody Long[] orderIds) {
//        return orderService.getOrderListBatch(orderIds);
//    }
    
}